package com.ncmmall.api.apis.service;

import java.util.HashMap;

/**
 * @author linxs
 */
public class Result {

    private int result = 1;
    private String msg = "成功";
    private Object data = new HashMap<>();

    public int getResult() {
        return result;
    }

    public Result exception() {
        this.result = -3;
        return this;
    }

    public Result fail() {
        this.result = -1;
        return this;
    }

    public Result forbidden() {
        this.result = -2;
        return this;
    }

    public Result ok() {
        this.result = 1;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Result setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getData() {
        return data;
    }

    public Result inject(Object data) {
        this.data = data;
        return this;
    }
}
